
</div>
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<!--<script src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script>-->
<script src="__PUBLIC__/js/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<!-- <script src="http://cdn.bootcss.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> -->
<script src="__PUBLIC__/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/js/mobile.js"></script>
<script>
    touch.on('.img-responsive', 'swiperight', function(){
        $(".left.carousel-control").click();
    });
    touch.on('.img-responsive', 'swipeleft', function(){
        $(".right.carousel-control").click();
    });

    function type(data){
        for(var j=0;j < data.length; j++)
        {
           return data[j].type;
        }
    }
    function tag(data){
        var tags=" ";
        for(var j=0;j < data.length; j++)
        {
             tags = tags + data[j].tag_name+" ";
        }
        return tags;
    }
    var flag = true;
    $("#more").on('click', function(){
        if(flag == true){
        flag = false;
        $.ajax({
            url: "{:U('View/ajaxview')}",

            type: 'get',

            data:{},

            dataType: 'json',

            timeout: 10000,

            error: function(){alert('出现错误了...刷新一下试试!');},

            success: function(data){
                flag = true;
                for(var i = 0; i < data.length; i++){
                    var store = '<div style="width:96%;margin:30px auto;background-color:white;padding-top:10px;border-radius:5px;box-shadow: 0 0 6px #ccc">';
                        store +='<div class="clear" style="margin:2%"><div style="width:20%">';
                        store +='<div  style="float:left;width:50px;height:50px;border-radius:100%;overflow: hidden">';
                        store +='<img src="'+data[i].show_pic+'" style="width: 100%;" alt=""/></div></div>';
                        store +='<div style="float:right;height:50px;width:78%">';
                        store += '<p class="store_name" style="font-size: 22px;margin-bottom:4px;color:#333333">'+data[i].store_name+'</p>';
                        store += '<p style="margin-top:4px" >商家类型：<span class="kind">'+data[i].school_name+'</span></p>';
                       store += '</div></div><div style="width:100%;margin-left:2%;overflow:hidden;margin-top:15px;">';
                       store += '<div style="width:70%;float:left"><img style="width:20px;" src="__PUBLIC__/images/tag.png" alt=""/>';
                       store += '<span style="color:#999999" class="tags">'+tag(data[i].tags)+'</span>';
                       store+= '</div><div style="width:30%;float:right"><span style="overflow:hidden">店主：<span class="buyer" >';
                       store +='<a style="color:#479eff" href="{:U("Person/index")}?person_id='+data[i].person_id+'">'+data[i].nickname+'</a></span></span>';
                       store += '</div></div><div class="shop_infro" style="width:100%;height:50px;background-color: white">';
                       store +='<div style="width:100%;height:45px;background-color:#fbfbfb;border-top:1px solid #dddddd;padding-top:4px;margin-top:10px;float:right">';
                       store += '<div style="float:right"><i class="iconfont">&#xe7c4;</i>';
                      store += '<span style="margin-right: 15px" class="view_count">'+data[i].click_num+'</span>';
                      store += '<i class="iconfont">&#xf003b;</i><span style="margin-right: 15px" class="comment_count">'+data[i].comment_num+'</span>';
                      store += '<a href="'+data[i].link+'" style="display: inline-block"><button class="btn btn-warning">进入店铺</button></a>';
                      store += '</div> </div></div></div>';
                    $("#more").before(store);
                    $("#more").prev().hide().fadeIn(1500);
                }

            }

        });
        }
    })

</script>

<script>
//特效代码
    $("#slideDown").on('click',function(){
        if($(".slideUl").css('display') == 'none'){
            $(".slideUl").show();
        }else{
            $(".slideUl").hide();
        }
    })
</script>


<script>
    var oparent = document.getElementById('main');
    var pin = document.getElementsByClassName('pin');


   window.onload = function(){
       waterfall()
   }
    function waterfall(){
        var _arr = [];
        for(var i = 0;i<pin.length;i++){
            var oHeight = pin[i].offsetHeight;
            if(i < 2){
                _arr[i] = oHeight;
            }else{
                var minH = Math.min.apply(null,_arr);
                var minHIndex = getminHIndex(_arr,minH);
                pin[i].style.position = 'absolute';
                pin[i].style.top = minH+'px';
                pin[i].style.left = pin[minHIndex].offsetLeft+'px';
                _arr[minHIndex] += oHeight;
            }
        }
        pin[pin.length-1].style.marginBottom = 50 + 'px';
        pin[pin.length-2].style.marginBottom = 50 + 'px';
    }


    function getminHIndex(arr,height){
        for(var i in arr){
            if(arr[i] == height){
                return i;
            }
        }
    }

</script>
</body>
</html>